package dao;

import dataBean.ScoreInfoDo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * Created by lxl on 2015/10/25.
 */
public interface ScoreInfoDao {

    @Insert("insert into score_info(performance,midterm,finals,overall)values(#{performance},#{midterm},#{finals},#{overall})")
    public int insertScoreInfo( ScoreInfoDo scoreInfoDo) ;

    @Select("select max(id) from score_info")
    public int getLasetID() ;

    @Update("update score_info set performance=#{performance},midterm=#{midterm},finals=#{finals},overall=#{overall} where id=#{id}")
    public int updateScoreInfoById(ScoreInfoDo scoreInfoDo) ;

    @Select("select *from score_info where id=#{id}")
    public ScoreInfoDo selectScoreInfoById( int id ) ;

    @Select("select *from score_info where id=( select score_id from scores where id = #{id} )")
    public ScoreInfoDo selectScoreInfoByCourseId( int id ) ;


}
